package com.sp.kafka.listener;

import com.alibaba.fastjson.JSON;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaListenter {

    @KafkaListener(topics = "testTopic", groupId = "test")
    public void onMessage(ConsumerRecord<?, ?> record){
        System.out.println("test " + JSON.toJSONString(record));
    }

    @KafkaListener(topics = "testTopic", groupId = "dev")
    public void onMessage2(ConsumerRecord<?, ?> record){
        System.out.println("dev " + JSON.toJSONString(record));
    }
}
